﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Data.SqlTypes;

namespace WindowsFormsApplication1
{
    public partial class Popupform_suplier : Form
    {
        public Popupform_suplier()
        {
            InitializeComponent();
        }

        private void Popupform_suplier_Load(object sender, EventArgs e)
        {
            DbConnet.connect(new Log().getConstr());
            String getSupp = "SELECT Suppcode,suppname FROM supplier";
            SqlDataReader supdr = DbConnet.ReadTable(getSupp);
            while(supdr.Read())
            {
                String name = supdr["Suppcode"].ToString() +" - "+ supdr["suppname"].ToString();
                listBox1.Items.Add(name);
            }
            supdr.Close();
        }

        private void listBox1_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            try
            {
                String value = listBox1.SelectedItem.ToString();
                new Midval().setSupName(value);
                this.Hide();
            }
            catch { }
        }
    }
}
